<%-
  ucid = channel.ucid
  author = HTML.escape(channel.author)
  channel_profile_pic = URI.parse(channel.author_thumbnail).request_target

  relative_url =
    case selected_tab
    when .shorts?    then "/channel/#{ucid}/shorts"
    when .streams?   then "/channel/#{ucid}/streams"
    when .playlists? then "/channel/#{ucid}/playlists"
    when .channels?  then "/channel/#{ucid}/channels"
    when .podcasts?  then "/channel/#{ucid}/podcasts"
    when .releases?  then "/channel/#{ucid}/releases"
    when .courses? then "/channel/#{ucid}/courses"
    else
      "/channel/#{ucid}"
    end

  youtube_url = "https://www.youtube.com#{relative_url}"
  redirect_url = Invidious::Frontend::Misc.redirect_url(env)

  page_nav_html = IV::Frontend::Pagination.nav_ctoken(locale,
    base_url: relative_url,
    ctoken: next_continuation,
    first_page: continuation.nil?,
    params: env.params.query,
  )
%>

<% content_for "header" do %>
<%- if selected_tab.videos? -%>
<meta name="description" content="<%= channel.description %>">
<meta property="og:site_name" content="Invidious">
<meta property="og:url" content="<%= HOST_URL %>/channel/<%= ucid %>">
<meta property="og:title" content="<%= author %>">
<meta property="og:image" content="<%= HOST_URL %>/ggpht<%= channel_profile_pic %>">
<meta property="og:description" content="<%= channel.description %>">
<meta name="twitter:card" content="summary">
<meta name="twitter:url" content="<%= HOST_URL %>/channel/<%= ucid %>">
<meta name="twitter:title" content="<%= author %>">
<meta name="twitter:description" content="<%= channel.description %>">
<meta name="twitter:image" content="<%= HOST_URL %>/ggpht<%= channel_profile_pic %>">
<link rel="alternate" type="application/rss+xml" title="RSS" href="/feed/channel/<%= ucid %>" />
<%- end -%>

<script src="/js/pagination.js?v=<%= ASSET_COMMIT %>"></script>

<link rel="alternate" href="<%= youtube_url %>">
<title><%= author %> - Invidious</title>
<% end %>

<%= rendered "components/channel_info" %>

<div class="h-box">
    <hr>
</div>


<%= rendered "components/items_paginated" %>
